
log using "C:\Users\hongj\Dropbox\Administration of UI Programs in the American States (Ji-Hyeun Hong)\Administrative Inequality Bias (Paper #1)\Data Replication File Materials (JPART)\Output\Merge and Inspection.02-01-2026.smcl", replace


use "C:\Users\hongj\Dropbox\Administration of UI Programs in the American States (Ji-Hyeun Hong)\Administrative Inequality Bias (Paper #1)\Data Replication File Materials (JPART)\Data\Admin_Bias.FINALIZED DATABASE.WithTotalCounts.05-05-2024.dta", clear


order gov_biz_binary, after(gov_bizyears)
order uihead_biz_binary, after(uihead_bizyears)
*
describe
summarize

merge 1:1 id using "C:\Users\hongj\Dropbox\Administration of UI Programs in the American States (Ji-Hyeun Hong)\Administrative Inequality Bias (Paper #1)\Data Replication File Materials (JPART)\Data\Ancillary Database_Error Detection Total Counts.04-22-2024.dta", keepusing(id ClaimantErrorDetection_Count) gen(_merge_clmterrdet_count)

merge 1:1 id using "C:\Users\hongj\Dropbox\Administration of UI Programs in the American States (Ji-Hyeun Hong)\Administrative Inequality Bias (Paper #1)\Data\June 2025\data mgmt\pca_bamdetamt_clmt.2002-2021.06-13-2025.dta", keepusing(id st_postal year bamdetamt_clmt bamdetct_clmt bam_totalct) gen(_merge_bam)

merge 1:1 id using "C:\Users\hongj\Dropbox\Administration of UI Programs in the American States (Ji-Hyeun Hong)\Administrative Inequality Bias (Paper #1)\Data\June 2025\data mgmt\eta_5130.employerappeals.07-04-2025.dta", keepusing(id st_postal year employerappeals_ct employerappeals_infavor_ct) gen(_merge_eta5130)


gen bamdetamt_clmtreal = bamdetamt_clmt/(cpi/100)

gen sai_detamt_clmtreal = detamt_clmtreal - bamdetamt_clmtreal

gen saidetct_clmtreal = ClaimantErrorDetection_Count - bamdetct_clmt


gen bamamt_relative = bamdetamt_clmtreal/detamt_clmtreal
gen bamct_relative = bamdetct_clmt/ClaimantErrorDetection_Count

* Footnote 1: BAM's benefit overpayment error sample coverage relative to the population of benefit overpayment detection cases .
sum bamamt_relative bamct_relative if id!="2014FL", detail



*** Region Variable: 
* o	South = 1
* o	MIdwest: East North Central = 2
* o	Midwest: West North Central [i.e., Plains] = 3
* o	Northeast = 4
* o	West = 5  

gen region=.
replace region=1 if st_postal=="DE"|st_postal=="FL"|st_postal=="GA"|st_postal=="MD"|st_postal=="NC"|st_postal=="SC"|st_postal=="VA"|st_postal=="WV"|st_postal=="AL"|st_postal=="KY"|st_postal=="MS"|st_postal=="TN"|st_postal=="AR"|st_postal=="LA"|st_postal=="OK"|st_postal=="TX" ///

replace region=2 if st_postal=="IL"|st_postal=="IN"|st_postal=="MI"|st_postal=="OH"|st_postal=="WI" ///

replace region=3 if st_postal=="IA"|st_postal=="KS"|st_postal=="MN"|st_postal=="MO"|st_postal=="NE"|st_postal=="ND"|st_postal=="SD"

replace region=4 if st_postal=="CT"|st_postal=="ME"|st_postal=="MA"|st_postal=="NH"|st_postal=="RI"|st_postal=="VT"|st_postal=="NJ"|st_postal=="NY"|st_postal=="PA"

replace region=5 if st_postal=="AZ"|st_postal=="CO"|st_postal=="ID"|st_postal=="MT"|st_postal=="NV"|st_postal=="NM"|st_postal=="UT"|st_postal=="WY"|st_postal=="AK"|st_postal=="CA"|st_postal=="HI"|st_postal=="OR"|st_postal=="WA"

tab region



*
describe
summarize


xtset state_numident year, yearly

*
** GENERATE ADDITIONAL 'SCALE' EFFECT CONTROL MEASURES BASED ON BAM QUALITY CONTROL SURVEY SAMPLING ESTIMATES OF TOTAL ADMINISTRATIVE ERRORS BY STATE AGENCY IN A GIVEN YEAR **
gen ln_clmterror_est = ln(clmterror_est + 1)

*
*
glm detamt_clmtreal i.gubapptauth_partisan_rescaled4  electionyear econideol_median  publicunion_cov  unemp_rate  ln_uiadmin_budget_real ln_pop_size ln_clmterror_est i.state_numident i.year,  family(normal) link(log) vce(cluster state_numident)

glm sai_detamt_clmtreal i.gubapptauth_partisan_rescaled4  electionyear econideol_median  publicunion_cov  unemp_rate  ln_uiadmin_budget_real ln_pop_size ln_clmterror_est i.state_numident i.year,  family(normal) link(log) vce(cluster state_numident)

drop _merge 


rename saidetct_clmtreal sai_detct_clmt

drop bamdetamt_clmt bamdetct_clmt bam_totalct _merge_bam bamdetamt_clmtreal ln_clmterror_est bamamt_relative bamct_relative



describe
summarize

save "C:\Users\hongj\Dropbox\Administration of UI Programs in the American States (Ji-Hyeun Hong)\Administrative Inequality Bias (Paper #1)\Data Replication File Materials (JPART)\Data\Admin_Bias.MASTER DATABASE.07-04-2025.dta", replace

**********************************************************************************************************************************************************************************************************************************

use "C:\Users\hongj\Dropbox\Administration of UI Programs in the American States (Ji-Hyeun Hong)\Administrative Inequality Bias (Paper #1)\JPART R&R\Statistics\Data Files\Admin_Bias.MASTER DATABASE.07-04-2025.dta", clear


*


describe
summarize


log close